from Base.base import Base
from selenium.webdriver.common.by import By
from utils.data_header import read_yaml
import os

class Page4(Base):
    # 获取定位信息
    current_dir = os.path.dirname(__file__)
    test_case = read_yaml(os.path.join(current_dir, '..', 'Config', 'endpoints.yaml'))
    case = test_case[3]

    manage_loc=(By.XPATH,case['manage_loc'])

    def manage(self):
        self.click(self.manage_loc)

    peizhi_loc=(By.XPATH,case['peizhi_loc'])

    def peizhi(self):
        self.click(self.peizhi_loc)

    addpeizhi_loc=(By.CLASS_NAME,case['addpeizhi_loc'])

    def addpeizhi(self):
        self.click(self.addpeizhi_loc)

    userhao_loc=(By.NAME,case['userhao_loc'])

    def userhao(self,userhaos):
        self.send_keys(self.userhao_loc,userhaos)

    username_loc=(By.NAME,case['username_loc'])

    def username(self,usernames):
        self.send_keys(self.username_loc,usernames)

    productcode_loc=(By.NAME,case['productcode_loc'])

    def productcode(self,productcodes):
        self.send_keys(self.productcode_loc,productcodes)

    productname_loc=(By.NAME,case['productname_loc'])

    def productname(self,productnames):
        self.send_keys(self.productname_loc,productnames)

    fundIntoType_loc=(By.ID,case['fundIntoType_loc'])

    def fundIntoType(self):
        self.select(self.fundIntoType_loc,'商家收款')

    riskDay_loc=(By.NAME,case['riskDay_loc'])

    def riskDay(self,riskDays):
        self.send_keys(self.riskDay_loc,riskDays)

    securityRating_loc=(By.ID,case['securityRating_loc'])

    def securityRating(self):
        self.select(self.securityRating_loc,'MD5')

    commit_loc=(By.XPATH,case['commit_loc'])

    def commit(self):
        self.click(self.commit_loc)

    edit_loc = (By.XPATH, case['edit_loc'])

    def edit(self):
        self.click(self.edit_loc)







